<?php
include_once('../JFileGlobals.php');

echo "Running Simple merge of two sample JFileGlobals";

$testText1 = "

globals
     integer            udg_currentabi
     unit               udg_currentcaster
     unit               udg_currenthurter
     group              udg_casters
     real               udg_delayhack
     real array         udg_castervars
     location           udg_sourcehack
     gamecache          udg_cscache
endglobals


//Caster System 13.1 ( http://wc3campaigns.net/vexorian )
//====================================================================================================================================================================
function Caster_UnitId takes nothing returns integer
    return 'e000' //// Caster Unit type rawcode  (changes betwen maps, always use it inside '')
endfunction

constant function Caster_DefaultAttackType takes nothing returns attacktype
    return ATTACK_TYPE_CHAOS // Default attack type used by the old functions and when you use 0 as DamageOptions
endfunction

constant function Caster_DefaultDamageType takes nothing returns damagetype
    return DAMAGE_TYPE_UNIVERSAL // Default damage type used by the old functions and when you use 0 as DamageOptions
endfunction

";

$testText2 = "

globals
     integer            udg_currentabiX
     unit               udg_currentcasterX
     unit               udg_currenthurterX
     group              udg_castersX
     real               udg_delayhackX
     real array         udg_castervarsX
     location           udg_sourcehackX
     gamecacheX         udg_cscacheX
endglobals


//Caster System 13.1 ( http://wc3campaigns.net/vexorian )
//====================================================================================================================================================================
function Caster_UnitId takes nothing returns integer
    return 'e000' //// Caster Unit type rawcode  (changes betwen maps, always use it inside '')
endfunction

constant function Caster_DefaultAttackType takes nothing returns attacktype
    return ATTACK_TYPE_CHAOS // Default attack type used by the old functions and when you use 0 as DamageOptions
endfunction

constant function Caster_DefaultDamageType takes nothing returns damagetype
    return DAMAGE_TYPE_UNIVERSAL // Default damage type used by the old functions and when you use 0 as DamageOptions
endfunction

";

$jFileGlobals1 = new JFileGlobals($testText1);
$jFileGlobals2 = new JFileGlobals($testText2);

$jFileGlobals1->absorbGlobals($jFileGlobals2);
echo $jFileGlobals1->getRawText();
?>